const WxParse = require('../../wxParse/wxParse.js')

Page({
    data: {
        phone: '',
        list: [],
        bgs: ['/images/pay.png', '/images/tel.png']
    },
    onLoad() {
        wx.showLoading({
            title: '加载中'
        })

        wx.showShareMenu({
            withShareTicket: true
        })

        wx.request({
            url: 'https://www.kelionline.com/api/miniProgram/mnm/noticeList',
            method: 'GET',
            success: res => {
                if (res.data.code == 0) {
                    wx.hideLoading()

                    const data = res.data.data

                    for (let i = 0; i < data.list.length; i++) {
                        WxParse.wxParse('content[' + i + ']', 'html', data.list[i].content, this)
                    }

                    this.setData({
                        phone: data.phone.trim(),
                        list: data.list
                    })
                }
            }
        })
    },
    dial() {
        wx.makePhoneCall({
            phoneNumber: this.data.phone
        })    
    }
})